<template>
  <div>
    <el-row :gutter="10" class="top">
      <el-col :span="7">
        <el-form-item label="搜索 ">
          <el-input
            v-model="val"
            size="default"
            placeholder="搜索ID/车次/车次类型"
            @change="() => Input()"
          />
        </el-form-item>
      </el-col>
      <el-col :span="7">
        <el-form-item label="车次类型">
          <el-select
            v-model="type"
            class="m-2"
            placeholder="Select"
            size="default"
            @change="() => Type()"
          >
            <el-option
              v-for="item in options"
              :key="item"
              :label="item"
              :value="item"
            />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="状态">
          <el-select
            class="m-2"
            placeholder="Select"
            size="default"
            v-model="state"
            @change="State()"
          >
            <el-option
              v-for="item in options1"
              :key="item"
              :label="item"
              :value="item"
            />
          </el-select>
        </el-form-item>
      </el-col>
      <!-- 车票添加  -->
      <el-col :span="4" v-if="$route.path === '/ticket'">
        <el-form-item label=" ">
          <el-button size="defalut" type="primary" @click="() => add()">
            新增车票
          </el-button>
        </el-form-item>
      </el-col>
      <!-- 订单添加.... -->
      <el-col :span="4" v-if="$route.path === '/order'">
        <el-form-item label=" ">
          <el-button size="defalut" type="primary" @click="() => add()">
            新增线路
          </el-button>
        </el-form-item>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: {
    val: {
      type: String,
      default: () => {
        return "";
      },
    },
    state: String,
    type: {
      type: String,
    },
  },
  data() {
    return {
      type: "全部",
      state: "全部",
      val: "",
      options: [
        "全部",
        "高速动车",
        "动车组",
        "城际高速",
        "直达特快",
        "空调特快",
        "快速",
        "普快",
      ],
      options1: ["全部", "停用", "启用"],
    };
  },
  methods: {
    Input() {
      this.$emit("Inputs", this.val);
    },
    State() {
      this.$emit("States", this.state);
      this.$emit("getlist");
    },
    Type() {
      this.$emit("Types", this.type);
      this.$emit("getlist");
    },
    add() {
      this.$emit("add");
    },
  },
};
</script>

<style>
</style>